/******************************************************************************
** 
** Fahrenheit to Celcius conversion table using a function. 
** 
** File name:	fahr_to_celc_func.c
** Compilation:	cc fahr_to_celc_func.c -o fahr_to_celc_func
** Execution:	./fahr_to_celc_func
** 
** Description:
** Prints the table of Fahrenheit and corresponding Celcius degrees.
** 
******************************************************************************/
#include <stdio.h>

#define LOWER   0
#define UPPER   300
#define STEP    20

float convert(int f); //function prototype

int main()
{
    int fahr;
    
    for (fahr=UPPER; fahr >=LOWER; fahr -=STEP) {
        printf("%3d %6.2f\n", fahr, convert(fahr));
    }
    
    return 0;
}

// convert: Gets the Fahrenheit dergee value and returns Celcius degree value
// as a float.
float convert(int f) {
    return (5.0/9.0)*(f-32.0);
}